//==================================================================
//  Copyright (C) 2006  Davide Pasca
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//==================================================================
///
///
///
///
//==================================================================

#ifndef M5D_UTILS_EXT_H
#define M5D_UTILS_EXT_H

//==================================================================
#include "psys.h"
#include "pmath.h"

//==================================================================
namespace M5D {

//==================================================================
Vector3 UnProject( const Vector3 &win, const Matrix44 &model_m, const Matrix44 &proj_m, const int vport[4] );

//==================================================================
void GetHRayFromWinPos( int in_x, int in_y,
					    const int viewport[4],
						const PMath::Matrix44 &modelview_m,
						const PMath::Matrix44 &project_m,
						PMath::Vector3 &ray_from,
						PMath::Vector3 &ray_dir );

//==================================================================
void TransArray( u_char *data, u_char *temp, int item_size, const int *tablep, int nv );

};


#endif
